package com.by_man.presenter.module_member_activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.KeyEvent;
import android.webkit.WebView;

import com.by_man.presenter.R;
import com.by_man.presenter.SharedApplication;
import com.by_man.presenter.main_page.MainActivity;

/**
 * Created by man on 2017-02-27.
 */
public class ActivityDetailActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        WebView webView = new WebView(this);
        webView.getSettings().setJavaScriptEnabled(true);
        String str = getIntent().getStringExtra("extra");
        try {
            if ("page_one" == str) {
                webView.loadUrl(getResources().getString(R.string.page_one));
            } else if ("page_two" == str) {
                webView.loadUrl(getResources().getString(R.string.page_two));
            } else if ("page_three" == str) {
                webView.loadUrl(getResources().getString(R.string.page_three));
            } else {
                webView.loadUrl(getResources().getString(R.string.page_four));
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

        setContentView(webView);
    }

//    @Override
//    public boolean onKeyDown(int keyCode, KeyEvent event) {
//        if (keyCode == KeyEvent.KEYCODE_BACK) {
//            Intent intent = new Intent(this, MainActivity.class);
//            intent.putExtra("position", 3);
//            startActivity(intent);
//        }
//        return super.onKeyDown(keyCode,event);
//    }
}
